package com.shengzai.flink.core


import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.windowing.assigners._
import org.apache.flink.streaming.api.windowing.time.Time




object Demo5ProcTime {
  def main(args: Array[String]): Unit = {

      val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment

      val socketDS: DataStream[String] = env.socketTextStream("master", 8888)

      socketDS
        .map((_,1))
        .keyBy(_._1)
        .window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
        .sum(1)
        .print()

      env.execute()
    

  }

}
